﻿using MicroOrm.Dapper.Repositories.Repositories;
using MicroOrm.Dapper.Repositories.SqlGenerator.Interfaces;
using MyServices.Models.Data;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyServices.Models
{
    public class BookingRepository : DapperRepository<Booking>
    {
        public BookingRepository(IDbConnection connection, ISqlGenerator<Booking> generator) : base(connection, generator) { }

        public override bool Delete(Booking instance)
        {
            try
            {
                return base.Delete(instance);
            }
            catch (Exception ex)
            {
                Log.Instance.Error(ex.Message, ex);
                return false;
            }            
        }

        public override async Task<bool> DeleteAsync(Booking instance)
        {
            try
            {
                return await base.DeleteAsync(instance);
            }
            catch (Exception ex)
            {
                Log.Instance.Error(ex.Message, ex);
                return false;
            }          
        }
    }
}
